<#import "/common/function.ftl" as fn>
<@fn.header _title="家庭成员可支配收入">
<script language="javascript" type="text/javascript" src="${base}/web/js/My97DatePicker/WdatePicker.js"></script>
<script language="javascript" type="text/javascript" src="${base}/web/js/JScript.js"></script>
</@fn.header>
<body>
	<div class="rightBk">
    	<@fn.position _value="信息录入 &gt;&gt; 家庭成员可支配收入" />
        
        <!-- 选项卡 -->
        <div style="margin:0px 0;height:30px">
	        <ul class="tab">
	            <li><a href="${base}/infoInput/familyBasicInfo/${checkTotal.id}/${taskId?c}/${result}">核对家庭基本信息</a></li>
		    	<li><a href="${base}/infoInput/familyMemberInfo/${checkTotal.id}/${taskId?c}/${result}">核对家庭成员基本信息</a></li>
		    	<li class="visited"><a href="${base}/infoInput/familyMemberIncome/${checkTotal.id}/${taskId?c}/${result}">家庭成员可支配收入</a></li>
		   	 	<li><a href="${base}/infoInput/familyMemberProperty/${checkTotal.id}/${taskId?c}/${result}">家庭成员财产</a></li>
		    	<li><a href="${base}/infoInput/sendCheck/${checkTotal.id}/${taskId?c}/${result}">发送信息核实</a></li>    
	        </ul>
        </div>
        
                <!-- title -->
        <div class="title">
            <div class="title-middle">
                <div class="title-left"></div>
                <div class="title-caption">核对家庭成员可支配收入申报信息概要</div>
                <div class="title-right"></div>
            </div>
        </div>
        
        <!-- table -->
        <table class="tableCenter" cellspacing="0" cellpadding="0">
            <tr>
                <th width="8%">序号</th>
                <th width="15%">姓名</th>
                <th width="26%">与申请人代表关系</th>
                <th width="26%">证件号</th>
                <th width="15%">总计</th>
            </tr>
            <#list familyMembers as fm>
  			<tr>
    			<td>${fm_index+1}</td>
    			<td><a href="#" onclick="showPerson('${fm.id}');">${fm.name}</a></td>
    			<td>${fm.relationMainApplicant}</td>
    			<td>${fm.idNumber}</td>
    			<#if fm.income!=null>
    				<td>${fm.income.totalIncome}</td>
    			<#else>
    			<td>0</td>
    			</#if>
  			</tr>
  			</#list>
        </table>
        <br />
        <!-- title -->
        <div class="title marginTop15" onclick="showTable();">
            <div class="title-middle">
                <div class="title-left"></div>
                <div class="title-caption">核对家庭成员可支配收入申报</div>
                <div class="title-right"></div>
            </div>
        </div> 
        
        <!-- table -->
        <form action="${base}/infoInput/updateFamilyMemberInfo/" method="POST" name="familyMemberForm" id="familyMemberForm">
        <table class="table2" style="" id="table2">
            <colgroup>
                <col style="width: 130px; background-color: #eef3f7;">
                <col style="width: 270px;">
                <col style="width: 80px;">
                <col style="width: 80px; background-color: #eef3f7; text-align:center;">
                <col style="width: 120px;">
                <col style="width: 100px;">
            </colgroup>
            <tbody><tr class="bkWhite">
                <td colspan="6">
                    核对起始时间：<input name="startDateApprovedIncome" type="text" id="startDateApprovedIncome" class="input4" value="" onClick="WdatePicker()" require="true" dataType="Require" msg="填写不正确" readonly="readonly" />
                    至
                    <input name="endDateApprovedIncome" type="text" id="endDateApprovedIncome" class="input4" value="" onClick="WdatePicker()" require="true" dataType="Require" msg="填写不正确" readonly="readonly" />
                </td>
            </tr>
            <tr>
                <td rowspan="9">
                    工资性收入
                </td>
                <td>
                    工资收入
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="salaryIncome" id="salaryIncome" type="text" class="input4">
                </td>
                <td rowspan="23">
                    转移性收入
                </td>
                <td>
                    失业保险金
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="unemployInsurance" id="unemployInsurance" type="text" id="txtKeZhiPeiZYShiYe" class="input4">
                </td>
            </tr>
            
            <tr>
                <td>奖金收入</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="bonusIncome" id="bonusIncome" type="text" class="input4"></td>
                <td>养老金</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="pension" id="pension" type="text" class="input4"></td>
            </tr>
            <tr>
                <td>补贴收入</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="subsidyIncome" id="subsidyIncome" type="text" class="input4"></td>
                <td>离退休金</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="retired" id="retired" type="text" class="input4"></td>
            </tr>
            <tr>
                <td>加班收入</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="overtimeIncome" id="overtimeIncome" type="text" class="input4"></td>
                <td>政府生活救助收入</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="assistantIncome" id="assistantIncome" type="text" class="input4"></td>
            </tr>
            <tr>
                <td>第二职业收入</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="secondEmployIncome" id="secondEmployIncome" type="text" class="input4"></td>
                <td>就业岗位补贴</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="jobsSubsidy" id="jobsSubsidy" type="text" class="input4"></td>
            </tr>
            <tr>
                <td>兼职收入</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="partTimeIncome" id="partTimeIncome" type="text" class="input4"></td>
                <td>社会保险费补贴</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="socialInsuranceSubsidy" id="socialInsuranceSubsidy" type="text" class="input4"></td>
            </tr>
            <tr>
                <td>零星劳动收入</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="otherIncome" id="otherIncome" type="text" class="input4"></td>
                <td>遗属补助金</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="survivorsSubsidy" id="survivorsSubsidy" type="text" class="input4"></td>
            </tr>
            <tr>
                <td>从事农副业生产获得的收入</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="agriculteIncome" id="agriculteIncome" type="text" class="input4"></td>
                <td>彩票收益</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="lotteryIncome" id="lotteryIncome" type="text" class="input4"></td>
            </tr>
            <tr>
                <td>集体经济分配收入</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="distributeIncome" id="distributeIncome" type="text" class="input4"></td>
                <td>赡（抚、扶）养费</td>
                <td><input require="true" dataType="Number" msg="填写不正确" name="alimony" id="alimony" type="text" class="input4"></td>
            </tr>
            
            <tr>
                <td rowspan="2">
                    经营性净收入
                </td>
                <td>
                    从事经工商和劳动部门登记的经营活动的净收入
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="registerIncome" type="text" id="registerIncome" class="input4">
                </td>
                <td>
                    辞退金
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="dismiss" type="text" id="dismiss" class="input4">
                </td>
            </tr>
            <tr>
                <td>
                    从事未经工商和劳动部门登记的经营活动的净收入
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="unRegisterIncome" type="text" id="unRegisterIncome" class="input4">
                </td>
                <td>
                    赔偿收入
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="compensationIncome" type="text" id="compensationIncome" class="input4">
                </td>
            </tr>
            <tr>
                <td rowspan="8">
                    财产性收入
                </td>
                <td>
                    银行存款利息收入
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="bankInterestIncome" type="text" id="bankInterestIncome" class="input4">
                </td>
                <td>
                    捐赠
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="donation" type="text" id="donation" class="input4">
                </td>
            </tr>
            <tr>
                <td>
                    基金收益
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="fundIncome" type="text" id="fundIncome" class="input4">
                </td>
                <td>
                    赠与收入
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="giftIncome" type="text" id="giftIncome" class="input4">
                </td>
            </tr>
            <tr>
                <td>
                    股息与红利收入
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="stockIncome" type="text" id="stockIncome" class="input4">
                </td>
                <td>
                    接受遗产收入
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="inheritanceIncome" type="text" id="inheritanceIncome" class="input4">
                </td>
            </tr>
            <tr>
                <td>
                    保险收益
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="insuranceIncome" type="text" id="insuranceIncome" class="input4">
                </td>
                <td>
                    奖学金
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="scholarship" type="text" id="scholarship" class="input4">
                </td>
            </tr>
            <tr>
                <td>
                    出租房屋或其他家庭财产收益
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="rentalHouseIncome" type="text" id="rentalHouseIncome" class="input4">
                </td>
                <td>
                    义务兵自谋职业补助金或退役安置费
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="soldierSubsidy" type="text" id="soldierSubsidy" class="input4">
                </td>
            </tr>
            <tr>
                <td>
                    知识产品收益
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="knowledgeIncome" type="text" id="knowledgeIncome" class="input4">
                </td>
                <td>
                    高温补贴费
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="highSubsidy" type="text" id="highSubsidy" class="input4">
                </td>
            </tr>
            <tr>
                <td>
                    其他投资收益
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="otherInvestIncome" type="text" id="otherInvestIncome" class="input4">
                </td>
                <td>
                    取暖补贴费
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="heatingSubsidy" type="text" id="heatingSubsidy" class="input4">
                </td>
            </tr>
            <tr>
                <td>
                    其他财产性收益
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="otherPropertyIncome" type="text" id="otherPropertyIncome" class="input4">
                </td>
                <td>
                    亲友搭伙费
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="friendsPartnerFee" type="text" id="friendsPartnerFee" class="input4">
                </td>
            </tr>
            <tr>
                <td colspan="3" rowspan="4">&nbsp;
                    
                </td>
                <td>
                    一次性支取的补充养老金
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="oneTimeAddPension" type="text" id="oneTimeAddPension" class="input4">
                </td>
            </tr>
            <tr>
                <td>
                    一次性支取的住房公积金（不含补充住房公积金）
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="oneTimeHouseFund" type="text" id="oneTimeHouseFund" class="input4" tabindex="32">
                </td>
            </tr>
            <tr>
                <td>
                    一次性支取的补充住房公积金
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="oneTimeAddHouseFund" type="text" id="oneTimeAddHouseFund" class="input4" tabindex="32">
                </td>
            </tr>
            <tr>
                <td>
                    其他补贴
                </td>
                <td>
                    <input require="true" dataType="Number" msg="填写不正确" name="otherSubsidy" type="text" id="otherSubsidy" class="input4" tabindex="35">
                </td>
            </tr>
		</tbody>
		</table>
        <input type="hidden" id="familyMemberId" name="familyMemberId" value=""/>
        <input type="hidden" name="checkTotalId" value="${checkTotal.id}"/>
        </form>
        <!-- button -->
        <div class="marginTop15 alignCenter">
            <img src="${base}/web/img/btnSave.gif" alt="" onclick="saveFamilyMemberIncome();"/>
        <!--     <img src="${base}/web/img/btnCancel.gif" alt="" />
            <img src="${base}/web/img/btnLast.gif" alt="" />
            <img src="${base}/web/img/btnNext.gif" alt="" />-->
        </div>
	</div>
	<script type="text/javascript">
         function showTable() {
             $("#table2").toggle(200);
         }
         
         function showPerson(personId) {
         		$("#table2").hide();
             	$("#table2").show(200);
                <#list familyMembers as data>
                if(personId=='${data.id}'){
                	$("#familyMemberId").val("${data.id}");
                	<#if data.income!=null>
	                    $("#registerIncome").val("${data.income.registerIncome}");
	                    $("#unRegisterIncome").val("${data.income.unRegisterIncome}");
	                    $("#bankInterestIncome").val("${data.income.bankInterestIncome}");
	                    $("#fundIncome").val("${data.income.fundIncome}");
	                    $("#stockIncome").val("${data.income.stockIncome}");
	                    $("#insuranceIncome").val("${data.income.insuranceIncome}");
	                    $("#rentalHouseIncome").val("${data.income.rentalHouseIncome}");
	                    $("#knowledgeIncome").val("${data.income.knowledgeIncome}");
	                    $("#otherInvestIncome").val("${data.income.otherInvestIncome}");
	                    $("#otherPropertyIncome").val("${data.income.otherPropertyIncome}");
	                    $("#salaryIncome").val("${data.income.salaryIncome}");
	                    $("#bonusIncome").val("${data.income.bonusIncome}");
	                    $("#subsidyIncome").val("${data.income.subsidyIncome}");
	                    $("#overtimeIncome").val("${data.income.overtimeIncome}");
	                    $("#secondEmployIncome").val("${data.income.secondEmployIncome}");
	                    $("#partTimeIncome").val("${data.income.partTimeIncome}");
	                    $("#otherIncome").val("${data.income.otherIncome}");
	                    $("#agriculteIncome").val("${data.income.agriculteIncome}");
	                    $("#distributeIncome").val("${data.income.distributeIncome}");
	                    $("#unemployInsurance").val("${data.income.unemployInsurance}");
	                    $("#pension").val("${data.income.pension}");
	                    $("#retired").val("${data.income.retired}");
	                    $("#assistantIncome").val("${data.income.assistantIncome}");
	                    $("#jobsSubsidy").val("${data.income.jobsSubsidy}");
	                    $("#socialInsuranceSubsidy").val("${data.income.socialInsuranceSubsidy}");
	                    $("#survivorsSubsidy").val("${data.income.survivorsSubsidy}");
	                    $("#lotteryIncome").val("${data.income.lotteryIncome}");
	                    $("#alimony").val("${data.income.alimony}");
	                    $("#dismiss").val("${data.income.dismiss}");
	                    $("#compensationIncome").val("${data.income.compensationIncome}");
	                    $("#donation").val("${data.income.donation}");
	                    $("#giftIncome").val("${data.income.giftIncome}");
	                    $("#inheritanceIncome").val("${data.income.inheritanceIncome}");
	                    $("#scholarship").val("${data.income.scholarship}");
	                    $("#soldierSubsidy").val("${data.income.soldierSubsidy}");
	                    $("#highSubsidy").val("${data.income.highSubsidy}");
	                    $("#heatingSubsidy").val("${data.income.heatingSubsidy}");
	                    $("#friendsPartnerFee").val("${data.income.friendsPartnerFee}");
	                    $("#oneTimeAddPension").val("${data.income.oneTimeAddPension}");
	                    $("#oneTimeHouseFund").val("${data.income.oneTimeHouseFund}");
	                    $("#oneTimeAddHouseFund").val("${data.income.oneTimeAddHouseFund}");
	                    $("#otherSubsidy").val("${data.income.otherSubsidy}");
	                    <#if checkTotal.startDateApprovedIncome!=null>
                    		$("#startDateApprovedIncome").val("${(checkTotal.startDateApprovedIncome)?string('yyyy-MM-dd')}");
                    	</#if>
                    	<#if checkTotal.startDateApprovedIncome!=null>
                    		$("#endDateApprovedIncome").val("${(checkTotal.endDateApprovedIncome)?string('yyyy-MM-dd')}");
                    	</#if>
                    <#else>
                    	$("#registerIncome").val("0");
	                    $("#unRegisterIncome").val("0");
	                    $("#bankInterestIncome").val("0");
	                    $("#fundIncome").val("0");
	                    $("#stockIncome").val("0");
	                    $("#insuranceIncome").val("0");
	                    $("#rentalHouseIncome").val("0");
	                    $("#knowledgeIncome").val("0");
	                    $("#otherInvestIncome").val("0");
	                    $("#otherPropertyIncome").val("0");
	                    $("#salaryIncome").val("0");
	                    $("#bonusIncome").val("0");
	                    $("#subsidyIncome").val("0");
	                    $("#overtimeIncome").val("0");
	                    $("#secondEmployIncome").val("0");
	                    $("#partTimeIncome").val("0");
	                    $("#otherIncome").val("0");
	                    $("#agriculteIncome").val("0");
	                    $("#distributeIncome").val("0");
	                    $("#unemployInsurance").val("0");
	                    $("#pension").val("0");
	                    $("#retired").val("0");
	                    $("#assistantIncome").val("0");
	                    $("#jobsSubsidy").val("0");
	                    $("#socialInsuranceSubsidy").val("0");
	                    $("#survivorsSubsidy").val("0");
	                    $("#lotteryIncome").val("0");
	                    $("#alimony").val("0");
	                    $("#dismiss").val("0");
	                    $("#compensationIncome").val("0");
	                    $("#donation").val("0");
	                    $("#giftIncome").val("0");
	                    $("#inheritanceIncome").val("0");
	                    $("#scholarship").val("0");
	                    $("#soldierSubsidy").val("0");
	                    $("#highSubsidy").val("0");
	                    $("#heatingSubsidy").val("0");
	                    $("#friendsPartnerFee").val("0");
	                    $("#oneTimeAddPension").val("0");
	                    $("#oneTimeHouseFund").val("0");
	                    $("#oneTimeAddHouseFund").val("0");
	                    $("#otherSubsidy").val("0");
	                    <#if checkTotal.startDateApprovedIncome!=null>
                    		$("#startDateApprovedIncome").val("${(checkTotal.startDateApprovedIncome)?string('yyyy-MM-dd')}");
                    	<#else>
                    		$("#startDateApprovedIncome").val("");
                    	</#if>
                    	<#if checkTotal.startDateApprovedIncome!=null>
                    		$("#endDateApprovedIncome").val("${(checkTotal.endDateApprovedIncome)?string('yyyy-MM-dd')}");
                    	<#else>
                    		$("#endDateApprovedIncome").val("");
                    	</#if>
                    </#if>
                }
                </#list>
         }
         
          function saveFamilyMemberIncome() {
			if(!Validator.Validate($("#familyMemberForm").get(0))){
		    	return false;
		    }
			    var url = "/infoInput/updateFamilyMemberIncome/";
			    $.ajax({
			           type: "POST",
			           url: url,
			           data: $("#familyMemberForm").serialize(),
			           error: function()
			           {
			               alert("出错啦！");
			           },
			           success: function(data)
			           {
			               if(data.result){
			               		alert("保存成功！");
			               		$(".visited").find("a")[0].click();
			               }else{
			               		alert("保存失败，请将表单信息填写完整！");
			               }
			           }
			         });
			}
     </script>
</body>
</html>